package startupcompanymanager2012;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Scanner;
//Copy of Test, runs as core for the moment, to access office and calendar and as reference.
//if we add the save/load function.....we will keep it in some form.
public class Test {

    public static Calendar c = Calendar.getInstance();
    public static ArrayList<Developer> devs = new ArrayList<Developer>();
    private static ArrayList<Game> games = new ArrayList<Game>();
    public static Office office = new Office(24, 4, 33, 
                        "Small place, but everything beginns here");
    public static int capital;
    
    public static void main(String[] args) {
        // DO NOT TOUCH!
        c.set(2000, Calendar.JANUARY, 1);
        Scanner scn = new Scanner(System.in);
        devs.add(new Developer("DesSpielers", "Name"));        
        
        int control, control2, tempInt1, tempInt2, tempInt3;
        String tempStr1;
        
        capital = 1000000;
//              do {
//              System.out.println("");
//              System.out.println("1 - Manage Developers");
//              System.out.println("2 - New Game Project");
//              System.out.println("3 - Work on Project");
//              System.out.println("4 - List Developers/Games");
//              System.out.println("0 - Exit");
//              System.out.print("Choose: ");
//              control = Core.readInt();
//
//              switch (control) {
//                  case 1:
//                      System.out.println("");
//                      System.out.println("1 - Hire Developer");
//                      System.out.println("2 - Upgrade Developer");
//                      System.out.println("3 - Fire Developer");
//                      System.out.print("Choose: ");
//                      control2 = Core.readInt();
//                     
//                      switch (control2) {
//                          case 1: // Hire Developer
//                              if (devs.size() < office.getWorkstations()) {
//                                  devs.add(new Developer());
//                                  System.out.println("You Hired:");
//                                  System.out.println(devs.get(devs.size() - 1) + "\n");
//                              } else {
//                                  System.out.println("\nNo more free Workstat1ions!!!");
//                              }                            
//                              break;
//                          case 2: // Modify Developer
//                              listDevelopers();
//                              System.out.print("Choose: ");
//                              tempInt1 = Core.readInt();
//                              devs.get(tempInt1).upgrade();
//                              break;
//                          case 3: // Fire Developer
//                              listDevelopers();
//                              System.out.print("Choose: ");
//                              tempInt1 = Core.readInt();
//                              if (tempInt1 == 0)
//                                  System.out.println("You cannot Fire yourself!"); //NOOB! :D
//                              else
//                              devs.remove(tempInt1);
//                              break;
//                          default:
//                              throw new AssertionError();
//                      }
//                      break;
//                  case 2:
//                      /*TODO GUI: New Game, Complete Constructor*/
//                       
//                       
//                      System.out.println("\nTo do-To do-To do-To do");
//                      System.out.print("Enter Name: ");
//                      tempStr1 = scn.nextLine();
//  
//                      System.out.print("Enter Lines (//Will later be calculated out of Gametype)(7000): ");
//                      tempInt1 = Core.readInt();
//  
//                      System.out.println("(//Genre, Language and Plattform will later be chosen here//");
//                      System.out.println("You created the Following game: ");
//                      System.out.println("\n" + games.get(games.size() - 1));
//                      break;
//                  case 3:
//                     listDevelopers();
//                      System.out.print("Choose: ");
//                      tempInt1 = Core.readInt();
//  
//                      listGames();
//                      System.out.print("Choose: ");
//                      tempInt2 = Core.readInt();
//  
//                      System.out.print("\nTimeframe (Days): ");
//                      tempInt3 = Core.readInt();
//  
////                      devs.get(tempInt1).develop(games.get(tempInt2), tempInt3);
//                      break;
//                  case 4:
//                     listDevelopers();
//                     listGames();
// 
//                  default:
//                      break;
//              }
//          } while (control != 0);
 
    }
    
    private static void controlDate(){
        int curryear = c.YEAR, currmonth = c.MONTH;
        c.add(c.DAY_OF_MONTH, 5);
        if (c.MONTH > currmonth) {
            for (int i = 0; i < devs.size(); i++) {
                devs.get(i).paySalary();
            }
        }
        if (c.MONTH > curryear) {
            payTaxes();
        }
    }
    
    private static void payTaxes(){
        capital *= 0.8;
    }
    
    private static void listDevelopers(){
        System.out.println("\nDevelopers: ");
        for (int i = 0; i < devs.size(); i++) {
            System.out.println(i + " - " + devs.get(i));
        }
    }
    
     private static void listGames(){
        System.out.println("\nGames: ");
        for (int i = 0; i < games.size(); i++) {
            System.out.println(i + " - " + games.get(i).getTitle() + "(" + games.get(i).getStatus() + "% complete)");
        }
     }
     
     public static int readInt(){
         Scanner scan = new Scanner(System.in);
         int number = Integer.parseInt(scan.nextLine());
         return number;
     }
     
   
}
